/**
    This file is part of no-more-denormals.

    no-more-denormals is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    no-more-denormals is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with no-more-denormals.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _NMD_SET_H_
#define _NMD_SET_H_

#ifdef __cplusplus
extern "C" {
#endif

#ifdef MAC
#include <fenv.h>
#endif

/**
C struct storing CPU/FPU/GPU/... flags for restoring purpose.
*/
typedef struct
{
#ifdef _WIN32
	unsigned int	mFPMode;
	int				mSSEMode;
#elif MAC
	fenv_t			mEnv;
#endif
	// TODO Linux?
} nmdSavedState;

/**
Set the DAZ and FTZ CPU/FPU/GPU/... flags to 1.
@param	pSaveInHere	The storing struct.
*/
void nmdSet(nmdSavedState* pSaveInHere);

/**
Restore the DAZ and FTZ CPU/FPU/GPU/... to their previous state.
@param	pRestoreFromHere	The storing struct.
*/
void nmdRestore(nmdSavedState* pRestoreFromHere);

#ifdef __cplusplus
}
#endif

#endif

